import { default as request, cloud }  from '@/framework/utils/request'

export function getTemplate(columnList) {
  return request({
    url: cloud.business+'/importOrExport/exportFile',
    method: 'post',
    data: {
      type: '9',
      columnList
    }
  })
}

export function importData({ file, menu, columns }) {
  return request({
    url: cloud.business+'/importOrExport/importInfo',
    method: 'post',
    data: {
      importFileId: file,
      menuCode: menu,
      columnList: columns
    }
  })
}

export function exportData({ type, url, params, method, columns }) {
  return request({
    url: cloud.business+'/importOrExport/exportFile',
    method: 'post',
    data: {
      type,
      url,
      params,
      method,
      freezePaneFirstRow: '0',
      columnList: columns
    }
  })
}

export function exportSelectedData({ type, url, params, method, columns, idList, idProp }) {
  return request({
    url: cloud.business+'/importOrExport/exportFile',
    method: 'post',
    data: {
      type,
      url,
      params,
      method,
      idList,
      removeRepeat: idProp,
      freezePaneFirstRow: '0',
      columnList: columns
    }
  })
}


